// PO对象, 实现repo的解库
package data

import (
	"github.com/google/wire"
	"store-assistant/internal/biz"
	"github.com/golang/protobuf/ptypes/timestamp"
)

var Provider = wire.NewSet(NewWarehouseDao, NewWarehouseItemMgoUtil, NewWarehouseMgoUtil)

type warehouseDao struct {
	itemDb *MongoUtil
	warehouseDb *MongoUtil
}
//对应warehouseItem表
type item_schema struct {
	ItemId 		string 
	Category 	string 
	Name 		string 
	Description string 
	Desc      	string 
	CreateTime  *timestamp.Timestamp 
	UpdateTime	*timestamp.Timestamp
}

//对应warehouse表
type warehouse_schema struct {
	ShopId 		string
	ItemId 		string 
	Inventory 	int64 
	ItemStat 	int 
}

// DO ----> PO 
func convertBizxxToDataXxx()  {

}

func NewWarehouseDao(itemDb *MongoUtil , wDb *Mu) (dao warehouseDao, cf func(), err error) {
	dao = newWarehouseDao(itemDb, wDb) 
	cf = dao.Close
	return 
}

func newWarehouseDao(itemDb *MongoUtil, wDb *Mu) warehouseDao { 
	
	return warehouseDao{
		itemDb: itemDb,
		warehouseDb: wDb,
	}	
}

func (w *warehouseDao) Close() {
	//这一层没有需要释放的资源
}

func (w *warehouseDao) GetShopItems(shopid string) ([]*biz.Item, error) {
	return []*biz.Item{} , nil 
}

func (w *warehouseDao) GetItemWithId(id string) (*biz.Item, error) {
	return &biz.Item{} , nil 
}

func (w *warehouseDao) UpdateItemSaleStatus(itemId string, stat int) error {
	return nil  
}

func (w *warehouseDao) AddInventory(itemId string, size int) error {
	return nil  
}

func (w *warehouseDao) CreateItem(item *biz.Item) error {
	return nil
}

